package com.tarena.lbs.content.dao.repository.impl;

import com.tarena.lbs.content.dao.mapper.ArticleMapper;
import com.tarena.lbs.content.dao.repository.ArticleRepository;
import com.tarena.lbs.content.pojo.po.ActionSearchPO;
import com.tarena.lbs.content.pojo.po.ArticleSearchPO;
import com.tarena.lbs.content.pojo.query.ArticleQuery;
import com.tarena.lbs.content.pojo.vo.ArticleActionPageResultVO;
import com.tarena.lbs.content.pojo.vo.ArticleVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Set;

@Repository
@Slf4j
public class ArticleRepositoryImpl implements ArticleRepository {
    @Autowired
    private ArticleMapper articleMapper;
    @Override
    public void insert(ArticleSearchPO articleSearchPO) {
        log.info("保存文章数据-仓库{}",articleSearchPO);
        articleMapper.insert(articleSearchPO);
    }

    @Override
    public List<ArticleVO> select(ArticleQuery articleQuery) {
        log.info("文章分页列表查询-仓库{}",articleQuery);
        List<ArticleVO> list=articleMapper.select(articleQuery);
        return list;
    }

    @Override
    public ArticleSearchPO articleDetail(String id) {
        ArticleSearchPO PO=articleMapper.selectById(id);
        return PO;
    }

    @Override
    public List<ArticleActionPageResultVO> articleBehavior(ActionSearchPO param) {
        List<ArticleActionPageResultVO> list=articleMapper.articleBehavior(param);
        return list;
    }

    @Override
    public Set<String> articleLabels(ArticleQuery articleQuery) {
        Set<String> articleLabels = articleMapper.articleLabels(articleQuery);
        return articleLabels;
    }
}
